import Vue from 'vue'
import VueRouter from 'vue-router'
// 引入组件
import Layout from '@/views/Layout'
import Article from '@/views/Article'
import ArticleDetail from '@/views/ArticleDetail'
import Collect from '@/views/Collect'
import Like from '@/views/Like'
import User from '@/views/User'
Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        // 整个页面
        {
            path: '/',
            component: Layout,
            // 底部按钮点击切换
            children: [
                {
                    path: '/article',
                    component: Article,
                },
                {
                    path: '/collect',
                    component: Collect,
                },
                {
                    path: '/like',
                    component: Like,
                },
                {
                    path: '/user',
                    component: User,
                },
            ],
        },
        {
            path: '/detail/:id', // 接收一个参数为id
            component: ArticleDetail,
        },
    ],
})

export default router
